﻿using Activity.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Activity.API
{
    public class KmJobHandler
    {
        /// <summary>
        /// 添加求职
        /// </summary>
        /// <returns></returns>
        public static int CreateJob(JobUser param)
        {
            var dc = new ActivityEntities();
            var job = new Job_User
            {
                UserName = param.UserName,
                Sex = param.Sex,
                Birthday = param.Birthday,
                Salary = param.Salary,
                Mobile = param.Mobile,
                Province = param.Province,
                City = param.City,
                Area = param.Area,
                Address = param.Address,
                Email = param.Email,
                JobType = param.JobType,
                WorkType = param.WorkType,
                CreateDate = DateTime.Now
            };
            dc.Job_User.Add(job);
            try
            {
                dc.SaveChanges();
                return 1;
            }
            catch(Exception ex)
            {
                Log.Error(ex);
                return 0;
            }
            
        }
    }

    public class JobUser
    {
        public string JobType { get; set; }
        public string UserName { get; set; }
        public int Sex { get; set; }
        public DateTime Birthday { get; set; }
        public string Salary { get; set; }
        public string Mobile { get; set; }
        public string Email { get; set; }
        public string Province { get; set; }
        public string City { get; set; }
        public string Area { get; set; }
        public string Address { get; set; }
        public string WorkType { get; set; }
        public DateTime CreateDate { get; set; }
    }

}
